package com.vonchange.purchase.dr.sys.web;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.data.provider.Page;
import com.vonchange.headb.core.map.HeaMap;
import com.vonchange.purchase.dr.sys.service.IDRSysDictItemService;
import com.vonchange.purchase.sys.bean.SysDictItem;

/**
 * 单表维护服务类
 * 实现对com.neusoft.race.sys.bean.SysDictItem对象信息的保存操作
 */
@Component("sysDictItemPR")
public class SysDictItemAction {
	@Resource
	private IDRSysDictItemService sysDictItemService;

	@DataProvider
	public void querySysDictItem(Page<SysDictItem> page, Map<String, Object> parameter) {
		if(null==parameter){
			parameter = new HashMap<String, Object>();
		}
		parameter.put("isDelete_eq", 0);
		page=sysDictItemService.findPageDR(page, new HeaMap().setAll(parameter));
	}
	@DataProvider
	public List<SysDictItem> queryListByDictId(String dictId) {
	    return 	sysDictItemService.findListDR(new HeaMap().set("dictId_eq", dictId).set("isDelete_eq", 0));
	}
	
	@DataResolver
	public void saveSysDictItem(Collection<SysDictItem> datas) throws Exception {
		sysDictItemService.updateCudDR(datas);
	}

}